import Vue from 'vue';
import App from './app.vue'
import './assets/styles/global.styl'

import Vuex from 'vuex'
import VueRouter from 'vue-router'

import createRouter from './config/router'
import createStore from './store/store'

Vue.use(VueRouter)
Vue.use(Vuex)

const router = createRouter()
const store = createStore()

// store.watch(state=>state.count + 1, ()=>{

// })

// 路由导航守卫 钩子
// router.beforeEach((to, from, next)=>{
//     console.log("before each invoked")
//     next()
//     // 验证页面登录显示
//     // if(to.fullPath === '/login'){
//     //     next()
//     // }else{
//     //     next('/login')
//     // }

// })

// router.beforeResolve((to, from, next)=>{
//     console.log("before resolve invoked")

//     next()
// })
// router.afterEach((to, from)=>{
//     console.log("after each invoked")
// })
new Vue({
    router,
    store,
    render: h =>{
        return h(App)
    }
}).$mount("#root")